package com.vilyever.socketclient.helper;

import com.vilyever.socketclient.SocketClient;

/**
 * SocketClientSendingDelegate
 * Created by vilyever on 2016/5/30.
 * Feature:
 */
public interface SocketClientSendingDelegate {
    /**
     * 数据包开始发送时的回调
     */
    void onSendPacketBegin(SocketClient client, SocketPacket packet);

    /**
     * 数据包完成发送时的回调
     */
    void onSendPacketEnd(SocketClient client, SocketPacket packet);

    /**
     * 数据包取消发送时的回调
     * 取消发送回调有以下情况：
     * 1. 手动cancel仍在排队，还未发送过的packet
     * 2. 断开连接时，正在发送的packet和所有在排队的packet都会被取消
     */
    void onSendPacketCancel(SocketClient client, SocketPacket packet);

    /**
     * 发送进度回调
     * @param client
     * @param packet 正在发送的packet
     * @param progress 0.0f-1.0f
     * @param sendedLength 已发送的字节数
     */
    void onSendingPacketInProgress(SocketClient client, SocketPacket packet, float progress, int sendedLength);
}
